package thinkingInJava.concurrency;

//: net/mindview/util/DaemonThreadPoolExecutor.java
import java.util.concurrent.*;

import test.thread.RunnableTest;

public class DaemonThreadPoolExecutor
extends ThreadPoolExecutor {
  public DaemonThreadPoolExecutor() {
    super(3, 5, 60L, TimeUnit.SECONDS,
      new SynchronousQueue<Runnable>(),
      new DaemonThreadFactory());
  }
  
  public static void main(String[] args) {
      DaemonThreadPoolExecutor exe = new DaemonThreadPoolExecutor();
      exe.execute(new RunnableTest("1"));
      exe.execute(new RunnableTest("2"));
      exe.execute(new RunnableTest("3"));
      exe.execute(new RunnableTest("4"));
      exe.execute(new RunnableTest("5"));
      exe.execute(new RunnableTest("6"));
      exe.execute(new RunnableTest("7"));
      try {
        Thread.sleep(1024*20);
    } catch (InterruptedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
      System.out.println("----------------");
  }
} ///:~
